import request from '@/utils/request'

const api = {
  list: '/repair-request/list',
  query: '/repair-request/query',
  add: '/repair-request/add',
  update: '/repair-request/update',
  delete: '/repair-request/delete',
  detail: '/repair-request/detail',
  assign: '/repair-request/assign',
  complete: '/repair-request/complete',
  status: '/repair-request/status'
}

export default {
  // 获取维修申请列表
  list(params) {
    return request({
      url: api.list,
      method: 'get',
      params
    })
  },
  
  // 查询维修申请
  query(params) {
    return request({
      url: api.query,
      method: 'get',
      params
    })
  },
  
  // 新增维修申请
  add(data) {
    return request({
      url: api.add,
      method: 'post',
      data
    })
  },
  
  // 更新维修申请
  update(data) {
    return request({
      url: api.update,
      method: 'put',
      data
    })
  },
  
  // 删除维修申请
  delete(id) {
    return request({
      url: `${api.delete}/${id}`,
      method: 'delete'
    })
  },
  

  
  // 获取维修申请详情
  detail(id) {
    return request({
      url: `${api.detail}/${id}`,
      method: 'get'
    })
  },
  
  // 指派维修人员
  assign(data) {
    return request({
      url: api.assign,
      method: 'put',
      data
    })
  },
  
  // 完成维修
  complete(data) {
    return request({
      url: api.complete,
      method: 'put',
      data
    })
  },
  
  // 更新申请状态
  updateStatus(data) {
    return request({
      url: api.status,
      method: 'put',
      data
    })
  }
}